package com.csx.base.design.behavior.visitor;

import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;

/**
 * @author cuisongxu
 * @date 2022/10/13 12:18
 */
public class Client {

    public static void main(String[] args) {

        List<Acceptable> products = new ArrayList<>();
        products.add(new Candy("大白兔奶糖", LocalDate.of(2018,10,1), 20.0f));
        products.add(new Wine("茅台白酒", LocalDate.of(1998,10,1), 8888.0f));
        products.add(new Fruit("草莓", LocalDate.of(2018,12,25), 10.0f, 2.5f));

        Visitor visitor = new DiscountVisitor(LocalDate.of(2019,1,1));
        for (Acceptable product : products) {
            product.accept(visitor);
        }
    }
}
